package com.lhy.tool.autoconfigation;

import freemarker.template.Configuration;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;

@Data
public class GeneratorConfiguration {
	
	@Autowired  
	Configuration freeMarkerConfiguration;
	
	@Autowired
    GeneratorProperties generatorProperties;

	GeneratorProperties.Project project;

	@PostConstruct
	public void init(){
		initFreeMarkerConfiguration();
		this.project = generatorProperties.getGlobalConfig().getProject();
	}
	
	private void initFreeMarkerConfiguration(){
		freeMarkerConfiguration.setClassForTemplateLoading(this.getClass(), generatorProperties.getGlobalConfig().getTemplatePath());
	}


}
